<!DOCTYPE html>
<html lang="en">
<!-- 没有做完，下次再做 -->

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <style>
        .search {
            height: 100px;
            width: 100%;
            background-color: antiquewhite;
        }
        
        .content {
            height: 300px;
            width: 100%;
            background-color: pink;
            display: flex;
        }
        
        .content1 {
            flex: 1;
            overflow: auto;
        }
        
        .content2 {
            flex: 3;
            background-color: rgb(243, 144, 144);
        }
        
        .content3 {
            flex: 1;
        }
        
        .start {
            height: 50px;
            width: 100%;
            background-color: rgb(231, 240, 182);
        }
    </style>
</head>
<!-- 歌曲搜索接口：
    请求地址：https://autumnfish.cn/search
    请求方式：get
    请求参数：keywords
    响应内容：歌曲搜索结果

-->

<body>
    <div id="a">
        <div class="search">
            <input type="text" placeholder="请输入搜索的歌曲" @keyup.enter='sousuo' v-model='gequ'>
        </div>
        <div class="content">
            <div class="content1">
                <p v-for='it in geshuzu'>{{it.name}}————作者：{{it.artists[0].name}}</p>

            </div>
            <div class="content2"></div>
            <div class="content3"></div>

        </div>
        <div class="start">start</div>
    </div>
    <script>
        new Vue({
            el: '#a',
            data: {
                gequ: '',
                geshuzu: [],

            },
            methods: {
                sousuo: function() {
                    var that = this;
                    axios.get('https://autumnfish.cn/search?keywords=' + this.gequ).then(function(response) {
                        // console.log(response.data.result.songs[0].artists[0].name);
                        that.geshuzu = response.data.result.songs;

                    }, function(err) {
                        console.log(err);
                    })
                }
            }
        })
    </script>
</body>

</html>